package com.ruoyi.web.task;


import com.ruoyi.system.domain.ByWxUser;
import com.ruoyi.system.mapper.ByWxUserMapper;
import com.ruoyi.system.service.ByWxQrcodeService;
import com.ruoyi.system.service.WxCreatQrCodeService;
import com.ruoyi.system.service.WxOcrService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.List;

@Configuration
@EnableScheduling
public class TestRunner {

    @Autowired
    private ByWxQrcodeService wxQrcodeService;

    @Autowired
    private WxOcrService wxOcrService;

    @Autowired
    private ByWxUserMapper byWxUserMapper;

    @Scheduled(fixedRate=60*1000)
    public void addWxUserTg(){
        // System.out.println("进行生成订单二维码");
        List<ByWxUser> list = byWxUserMapper.queryUserNoImg();
        for(ByWxUser user:list){
            String id = user.getId();
            wxQrcodeService.createWxUserFx(id);
//            wxQrcodeService.createPayQrCode(id);
//            wxQrcodeService.createQrCode(id);
        }

    }

//    @Scheduled(fixedRate=5*60000)
    public void addCoachPass(){
        System.out.println("进行生成订单二维码");
        wxQrcodeService.createQrCode("5");
    }


//    private final static String accUrl = "https://www.zhaobangyang.cn:1000/img/2023/06/34d3069b-b16b-4017-86c6-2ec697fbe731.jpg";
//    private final static String accUrl = "https://www.zhaobangyang.cn/IMG_20220708_125458.jpg";
//    @Scheduled(fixedRate=5*60000)
    public void test() throws Exception {
        System.out.println("OCR识别身份证信息-----");
//        Object obj = wxOcrService.ocrIdCard(accUrl);
//        String accUrl = "https://www.zhaobangyang.cn/IMG_20220708_125458.jpg";
        String accUrl = "https://www.zhaobangyang.cn:1000/img/2023/06/34d3069b-b16b-4017-86c6-2ec697fbe731.jpg";
        Object obj = wxOcrService.uploadCard(accUrl);
        System.out.println(obj.toString());
    }
}
